var duck={
  duckSinging:function(){
    console.log('嘎嘎嘎')
  }
}
var chicken={
  duckSinging:function(){
    console.log('嘎嘎嘎')
  }
}
var choic=[]
var joinChoic=function(animal){
  if(animal&&typeof animal.duckSinging==='function'){
     choic.push(animal)
     console.log('恭喜加入合唱团')
     console.log('合唱团已有成员数量:',choic.length)
  }
}
joinChoic(duck)
joinChoic(chicken)

var makeSound=function (animal){
  if(animal instanceof Duck){
     console.log('嘎嘎嘎') 
  }
  else if(animal instanceof Chicken){
    console.log('咯咯咯')
  }
}
var Duck=function(){
}
var Chicken=function(){
  
}
makeSound(new Duck())
makeSound(new Chicken())